package kr.hkit.androidcomplete01.ch08;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class HandleEvent4 extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyView4 vw = new MyView4(this);
		vw.setOnTouchListener(vw);
		setContentView(vw);
	}

	class MyView4 extends View implements View.OnTouchListener {
		public MyView4(Context context) {
			super(context);
		}

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
				Toast.makeText(HandleEvent4.this, "This Event Received4",
						Toast.LENGTH_SHORT).show();
				return true;
			}
			return false;
		}
	}
}
